<?php
require "././vendor/autoload.php";

use \PhpAmqpLib\Connection\AMQPStreamConnection;
use \PhpAmqpLib\Exchange\AMQPExchangeType;
use \PhpAmqpLib\Message\AMQPMessage;

$host = PHP_OS == "Linux" ? "127.0.0.1" : "10.0.0.200";

$queueName = "workQueue";
$exchangeName = "workExchange";
$routeKey = "workRouteKey";

$con = new AMQPStreamConnection('10.0.0.200', '5672', 'wyqgg', '123456');
$ch = $con->channel();

$cu1 = function (AMQPMessage $message){
    echo $message->getBody().PHP_EOL;
    $message->ack();
    usleep(1000);
};

$ch->basic_consume($queueName,'',false,false,false,false,$cu1);

while ($ch->is_consuming()){
    $ch->wait();
}
$ch->close();
$ch->close();